package com.zzyl.nursing.ws;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class TaskTest {
    @Autowired
    private WebSocketServer webSocketServer;

    //十秒触发一次
    @Scheduled(cron = "0/10 * * * * ?")
    public void test() throws IOException {
        webSocketServer.sendMessageToAll("乐乐冲锋，冲锋");
    }
}
